<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="lib/vue-2.4.0.js"></script>
    <style>
        .inner {
            height: 150px;
            background-color: aquamarine;
        }

        .outer {
            padding: 40px;
            background-color: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- <div class="inner" @click='div1Handler'>
            <input type="button" value="戳他" @click.stop='btnHandler'>
        </div> -->
        <!-- <a href="http://www.baidu.com" @click.prevent='linkClick'>有问题，先去百度</a> -->
        <!-- <a href="http://www.baidu.com" @click.prevent.once='linkClick'>有问题，先去百度</a> -->

        <!--使用 .capture 实现捕获事件的机制  -->
        <!-- <div class="inner" @click.capture='div1Handler'>
            <input type="button" value="戳他" @click.stop='btnHandler'>
        </div> -->
        <!-- <div class="inner" @click.self='div1Handler'>
            <input type="button" value="戳他" @click='btnHandler'>
        </div> -->
        <div class="outer" @click='div2Handler'>
            <div class="inner" @click.self='div1Handler'>
                <input type="button" value="戳他" @click='btnHandler'>
            </div>
        </div>

    </div>


    <script>
        /* 创建Vue实例 ，得到viewModel */
        var vm = new Vue({
            el: '#app',
            data: {},
            methods: {
                div1Handler() {
                    console.log('这是触发了 inner div 的点击事件')
                },
                btnHandler() {
                    console.log('这是触发了 btn 按钮的点击事件')
                },
                linkClick() {
                    console.log('触发了连接的点击事件')
                },
                div2Handler() {
                    console.log('这是触发了 outer div的点击事件')
                }
            }
        })
    </script>
</body>

</html>